import httpRequest from '@/request'
import appConfig from '@/config/index'

// 用户表格
export function userListPage (params: any) {
  return httpRequest({
    url: `${appConfig.api}user/search`,
    method: 'post',
    data: params
  })
}

// 新增用户
export function userInsert (params: any) {
  return httpRequest({
    url: `${appConfig.api}user/create`,
    method: 'post',
    data: params
  })
}

// 编辑用户
export function userUpdate (params: any) {
  return httpRequest({
    url: `${appConfig.api}user/update`,
    method: 'post',
    data: params
  })
}

// 删除用户
export function userDelete (params: any) {
  return httpRequest({
    url: `${appConfig.api}user/delete`,
    method: 'post',
    data: params
  })
}

// 批量更新用户分组
export function userGroupBatchUpdate (params: any) {
  return httpRequest({
    url: `${appConfig.api}user/updateGroup`,
    method: 'post',
    data: params
  })
}

// 下载模板
export function userDownloadTemplate () {
  return httpRequest({
    url: `${appConfig.api}user/downloadTemplate`,
    method: 'get',
    responseType: 'blob'
  })
}

// 批量导入用户
export function userBatchInsert (params: any) {
  return httpRequest({
    url: `${appConfig.api}user/createBatch`,
    method: 'post',
    data: params
  })
}
